package demo1;

/**
 * interface是用来修饰接口的
 * 接口不能进行实例化
 * 接口当中 不能有被实现的方法，意味着只能有抽象方法。但是两个方法除外：一个是static修饰的方法 一个是被deflaut修饰的方法
 */
interface Shape {
    //public abstract void draw(); 接口中的抽象方法默认是public abstract修饰的
    void draw();

    /*
public static final int a = 0;接口中的成员变量默认是public static final修饰的

    int A = 1;
    int B = 2;
    int C = 3;

*/
}

class Rect implements Shape {
    @Override
    public void draw() {
        System.out.println("矩形！");
    }
}

class Flower implements Shape{
    @Override
    public void draw() {
        System.out.println("❀");
    }
}

public class Test {
    public static void drawMap(Shape shape){
        shape.draw();
    }
    public static void main(String[] args) {
        Shape shape1 = new Rect();
        Shape shape2 = new Flower();

        drawMap(shape1);
        drawMap(shape2);

        Shape[] shapes = {new Rect(),new Rect(),new Flower(),new Flower()};
        for (Shape shape :shapes
             ) {
            shape.draw();
        }
    }
}
